<!--
 * @Author: HeAo
 * @Date: 2021-12-29 09:38:55
 * @LastEditTime: 2021-12-29 09:54:21
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \study\day04\3-条件渲染.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
  <style>
    .box {
      width: 200px;
      height: 200px;
      background-color: teal;
    }

    .box1 {
      width: 200px;
      height: 200px;
      background-color: orange;
    }

    .box2 {
      width: 200px;
      height: 200px;
      background-color: red;
    }

    .box3 {
      width: 200px;
      height: 200px;
      background-color: green;
    }
  </style>
</head>

<body>
  <div id="app">
    <button @click="isActive = !isActive">变幻</button>
    <div v-if="isActive" class="box"></div>

    <div v-if="num == 1" class="box1"></div>
    <div v-else-if="num == 2" class="box3"></div>
    <div v-else class="box2"></div>

    <br>
    <div v-show="isActive" class="box"></div>
  </div>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        isActive: false,
        num: 0
      },
      methods: {

      }
    })
  </script>
</body>

</html>